import commonList from '@/components/common/commonListbihe'
export default {

	data() {
		return {
			Inv: 0,
			// 新增
			num: 0,
			// 未提交数组
			tableData: [],
			userInfo: {},
			// 
			table_config: [{
					label: "取样编号",
					prop: "fReportno",
					isLine: false,

				},
				{
					label: "出库状态",
					prop: "fClosestatus",
					isLine: false,
				},
				{
					label: "项目简称",
					prop: "fProjectname",
					isLine: true,
				},
				{
					label: "强度等级",
					prop: "fConcretelevel",
					isLine: true,
				}, 
				{
					label: '测区数',
					prop: 'fTestNum',
					isLine: true,
				},
				{
					label: "检测时间",
					prop: "fPlandates",
					isLine: true,
				},
			],
		}
	},
	components: {
		commonList,
	},
	onShow() {
		var that = this
		if (this.Inv == 0) {
			setTimeout(() => {
				that.unsubmit()
			}, 300)
		}
		if (this.Inv == 1) {
			setTimeout(() => {
				that.submit()
			}, 300)
		}

	},
	onLoad(option) {
		var that = this
		if (option.Inv) {
			this.Inv = option.Inv
		}
		this.getLocalData()
	},
	// 新增
	onNavigationBarButtonTap(e) {
		if (e.index === 0) {
			var url = "/pages/apply/intelligentMaintenanceManage/sampleStorage/inter/index"
			uni.navigateTo({
				url: url
			});
		}
	},
	// 返回
	onBackPress(event) {
		uni.switchTab({
			url: '/pages/home/index'
		});
		return true;
	},

	methods: {
		// 查看
		yj_viewForm(e) {
			console.log(e,44);
			if (e.Inv == 0) {
				// uni.navigateTo({
				// 	url: "/pages/apply/reboundStrengthManage/reboundUnqualifiedData/inter/index?id=" + e.id+"&status="+JSON.parse(e.item).fStatus+"&row="+JSON.stringify(e)
				// });


				uni.navigateTo({
					url: "/pages/apply/reboundStrengthManage/reboundUnqualifiedData/inter/index?id=" + e.id + "&fId=" +
						e.item
				});
				return false;
			}
			

		},
		submit() {
			var that = this
			this.Inv = 1
			this.yj_searchForm(this.Inv)
		},
		unsubmit() {
			var that = this
			this.Inv = 0
			this.yj_searchForm(this.Inv)
		},

		getLocalData() {
			var that = this
			uni.getStorage({
				key: 'userInfo',
				success: function(res) {
					that.userInfo = JSON.parse(res.data)
					that.companyId = that.userInfo.companyId;
				}
			})
		},
		callback() {},
		// 获取列表
		yj_searchForm(num) {
			var that = this
			num = num.toString()
			var datas = {

				startDates: "", //报告日期开始时间
				endDates: "" ,//报告日期结束时间
				fCompanyid: that.userInfo.companyId, // 左侧选中组织机构id
				modelType:"3",
				page: 1, // 当前页码
				pageSize: 50, // 每页显示条数
				userId: that.userInfo.userId, // 查询待办或已办时传 列表页查询不传
				
			}
			// uni.showToast({
			// 	title: JSON.stringify(datas),
			// 	icon: 'none',
			// 	duration: 100000
			// });
			// ,
			console.log(7878,this.$http);
			this.$http.getConcreteChecksamplePageList(datas).then(res => {
				if (res.errcode == 0) {
					that.tableData = []
					that.tableData = res.data.pageInfo.list

					// }, 1000)

				} else {
					console.log("接口报错")
				}
			}, (err) => {
				uni.showToast({
					title: "获取数据失败",
					icon: 'none',
					duration: 2000
				});
			})

		}


	}
}
